package leetcode;

/**
 * @Project : ProgrammingExercises
 * @Package : Leetcode
 * @File : Q2562.java
 * @Author : WangRuoyu
 * @Date 2023/2/22 11:12
 */

public class Q2562 {
    public long findTheArrayConcVal(int[] nums) {
        long res = 0;
        int p = 0;
        int q = nums.length - 1;

        while (p <= q) {
            if (p == q) {
                res += nums[p];
            } else {
                String str = Integer.toString(nums[p]) + Integer.toString(nums[q]);
                res += Integer.parseInt(str);
            }

            p++;
            q--;
        }
        return res;
    }

    public static void main(String[] args) {
        Q2562 sl = new Q2562();
        int[] nums = {7, 52, 2, 4};
        System.out.println(sl.findTheArrayConcVal(nums));
    }
}